import { AuthUSerType } from '@/types/user';
import request from './request';
import { useBackStore } from '@/store/background';

const auth = useBackStore();

// 用户模块
export const getIconList = () => request.get('/v1/emoji/icon-list');
export const getCaptcha = () =>
  request.get('/v1/user/captcha', null, { responseType: 'blob' });
export const accountRegister = (params: AuthUSerType) =>
  request.post('/v1/user/register', params, {
    headers: {
      captcha: auth.captcha,
      code: params.code,
    },
  });
export const accountLogin = (params: AuthUSerType) =>
  request.post('/v1/user/login', params, {
    headers: {
      captcha: auth.captcha,
      code: params.code,
    },
  });

//其他模块
export const auspicious = () => request.get('/other/auspicious');
